//package com.xyzh.stj.web.controller;
//
//
//import com.alibaba.fastjson.JSONObject;
//import com.xyzh.stj.web.entity.UserEntity;
//import com.xyzh.stj.web.service.UserInfoService;
//import com.xyzh.application.config.log.LogRecord;
//import com.xyzh.application.config.log.OperateEnum;
//import com.xyzh.application.common.util.ResultHelper;
//import com.xyzh.jtzq.web.dto.uservo.UserLogin;
//
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.http.*;
//import org.springframework.util.LinkedMultiValueMap;
//import org.springframework.util.MultiValueMap;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.web.client.HttpClientErrorException;
//import org.springframework.web.client.RestTemplate;
//
//import java.net.URI;
//
///**
// * <p>
// * 菜单表 前端控制器
// * </p>
// *
// * @author jzb
// * @since 2021-05-25
// */
//@Api(tags = "授权模块")
//@RestController
//@RequestMapping("/author")
//@Slf4j
//public class AuthorController {
//
//    @Autowired
//    private RestTemplate restTemplate;
//
//
//
//
//    @Value("#{applicationProperies.authoration.clientId}")
//    private  String client_id;
//
//    @Value("#{applicationProperies.authoration.clientSecret}")
//    private String client_secret;
//
//    @Value("#{applicationProperies.authoration.url}")
//    private String url;
//
//
//
//    @Autowired
//    private UserInfoService userInfoService;
//
////    @Autowired
////    private VerifyCodeService verifyCodeService;
//
//
//    @ApiOperation("获取权限")
//    @PostMapping("/token")
//    @LogRecord(appName = "安居后台", logType = 2, category = "", bizNo = "ouathor", content = "'进行免登录操作,操作结果编码:'+#r.code+',操作结果:'+#r.data", model = "系统管理-用户登录", operateEnum = OperateEnum.LOGIN)
//    public ResultHelper login(@RequestBody UserLogin login) throws Exception {
//        MultiValueMap<String, String> paramMap = new LinkedMultiValueMap<>();
//        //超管密码dzt@888
//        paramMap.add("username", login.getUsername());
//        paramMap.add("password", login.getPassword());
//        paramMap.add("client_id", client_id);
//        paramMap.add("client_secret", client_secret);
//        paramMap.add("scope", "all");
//        paramMap.add("grant_type", "password");
//        HttpHeaders headers = new HttpHeaders();
//        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
//        try {
//            HttpEntity<MultiValueMap<String, String>> entity = new HttpEntity<MultiValueMap<String, String>>(paramMap, headers);
//            ResponseEntity<String> exchange = restTemplate.exchange(URI.create(url), HttpMethod.POST, entity, String.class);
//            if (exchange.getStatusCodeValue() == HttpStatus.OK.value()) {
//                return ResultHelper.succeed(JSONObject.parse(exchange.getBody()));
//            }
//        } catch (HttpClientErrorException e) {
//            return ResultHelper.failed2Msg("用户名密码错误");
//        }
//        return ResultHelper.succeed(null);
//    }
//
////    @ApiOperation("获取验证码")
////    @GetMapping("/verifyCode")
////    public ResultHelper<String> verifyCode() {
////
////        return ResultHelper.succeed( verifyCodeService.getVerifyCode());
////    }
//
//
//    @ApiOperation("注册用户")
//    @PostMapping("/regedit")
//    public ResultHelper login(@RequestBody UserEntity user){
//      return   ResultHelper.succeed( userInfoService.saveEntity(user));
//
//    }
//}
